<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>设置 tokenHandler 句柄回调函数</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="oauthprovider.timestampnoncehandler.html">« OAuthProvider::timestampNonceHandler</a></li>
      <li style="float: right;"><a href="class.oauthexception.html">OAuthException »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.oauthprovider.html">OAuthProvider</a></li>
    <li>设置 tokenHandler 句柄回调函数</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="oauthprovider.tokenhandler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">OAuthProvider::tokenHandler</h1>
  <p class="verinfo">(PECL OAuth &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">OAuthProvider::tokenHandler</span> &mdash; <span class="dc-title">设置 tokenHandler 句柄回调函数</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-oauthprovider.tokenhandler-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>OAuthProvider::tokenHandler</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback_function</code></span>): <span class="type"><span class="type void">void</span></span></div>

  <p class="para rdfs-comment">
   设置令牌句柄的回调函数，此回调函数将在后面被 <span class="methodname"><a href="oauthprovider.calltokenhandler.html" class="methodname">OAuthProvider::callTokenHandler()</a></span> 调用。
  </p>

  <div class="warning"><strong class="warning">警告</strong><p class="simpara">本函数还未编写文档，仅有参数列表。</p></div>

 </div>


 <div class="refsect1 parameters" id="refsect1-oauthprovider.tokenhandler-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">callback_function</code></dt>

    <dd>

     <p class="para">
      <span class="type"><span class="type 回调类型">回调类型</span></span> 的函数名。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-oauthprovider.tokenhandler-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-oauthprovider.tokenhandler-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-5324">
   <p><strong>示例 #1 <span class="methodname"><strong>OAuthProvider::tokenHandler()</strong></span> 回调的例子</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">tokenHandler</span><span style="color: #007700">(</span><span style="color: #0000BB">$provider</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$provider</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">token&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #DD0000">'rejected'</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">OAUTH_TOKEN_REJECTED</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif&nbsp;(</span><span style="color: #0000BB">$provider</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">token&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #DD0000">'revoked'</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">OAUTH_TOKEN_REVOKED</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$provider</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">token_secret&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"the_tokens_secret"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">OAUTH_OK</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-oauthprovider.tokenhandler-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="methodname"><a href="oauthprovider.calltokenhandler.html" class="methodname" rel="rdfs-seeAlso">OAuthProvider::callTokenHandler()</a> - 调用 tokenNonceHandler 回调函数</span></li>
  </ul>
 </div>


</div></div></div></body></html>